This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
require("jsonlite")
## Loading required package: jsonlite
##
## Attaching package: 'jsonlite'
##
## The following object is masked from 'package:utils':
##
## View
require("RCurl")
## Loading required package: RCurl
## Loading required package: bitops
require("dplyr")
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
##
## The following objects are masked from 'package:stats':
##
## filter, lag
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
require("ggplot2")
## Loading required package: ggplot2
require("knitr")
## Loading required package: knitr
require("dplyr")
require("extrafont")
## Loading required package: extrafont
## Registering fonts with R
CREATE TABLE carconsump ( – Change table_name to the table name you want. year varchar2(4000), manufacturer varchar2(4000), model varchar2(4000), engine varchar2(4000), transmission varchar2(4000), transmission_type varchar2(4000), fuel_type varchar2(4000), X varchar2(4000), X_1 varchar2(4000), X_2 varchar2(4000), X_3 varchar2(4000), X_4 varchar2(4000), X_5 varchar2(4000), X_6 varchar2(4000), X_7 varchar2(4000), X_8 varchar2(4000), X_9 varchar2(4000), euro_standard number(38,4), engine_capacity number(38,4), urban_metric number(38,4), extra_urban_metric number(38,4), combined_metric number(38,4), urban_imperial number(38,4), extra_urban_imperial number(38,4), combined_imperial number(38,4), noise_level number(38,4), co2 number(38,4), co_emissions number(38,4), fuel_cost_6000_miles number(38,4) );
##The second key aspect of TDE design is how they are structured which impacts how they are loaded into memory and used by Tableau.TDEs use all parts of your computer’s memory, from RAM to hard disk, and put each part to work as best fits its characteristics. To better understand, I tried to use connect to our data UK Car Fuel Consumptions and Emissions with an Extract API script in python, where I explored and walked through how a TDE is created from a CSV and then later used in our project as the data source for one or more visualizations.
##When Tableau creates a data extract, it first defines the structure for the TDE and creates separate files for each column in the underlying source.To complete the creation of a TDE, individual column files are combined with metadata to form a memory-mapped file. Because a TDE is a memory-mapped file, when Tableau requests data from a TDE, the data is loaded directly into memory by the operating system. Tableau doesn’t have to open, process or decompress the TDE to start using it. If necessary, the operating system continues to move data in and out of RAM to insure that all of the requested data is made available to Tableau. This is a key point - it means that Tableau can query data that is bigger than the available RAM on a machine!
I extracted the first 5000 thousand rows of our dataset, carconsump.reformatted.csv of total of 10,000 rows and save it as a .tde called carconsump.reformatted_5000Rows.tde. So I created a TDE from a CSV. Follows are the procedures to create a TDE:
###The main fuel type used by this group of cars with price rage 30,000 - 150,000 are Diesel and Petrol. If using Deisel, Mercedez-Benz, Audi, BMW, Jaguar and all except Land Rover has mean emissions between 150 - 200 grammes per kilometre (g/km). If using Petrol, Mercedez-Benz, Audi, BMW have average near 200 grammes per kilometre (g/km). The worst performing manufacturer is Land Rover which has mean Co2 emissions up to 350 grammes per kilometre (g/km).
###Interestingly, top luxury car manufacturers such as Maserati, Lamborghini, Rolls-Royce, Ferrari, and Aston Martin Lagonda can only use one fuel type Petrol. Highest mean Co2 emission – Lamborghini up to 600 (g/km). ###If we plot out the boxplot of luxury cars’ Co2 emissions and Noise level, we see that the avaerage of Co2 emissions is around 211 g/km, and average of Noise level is up to 71 measured on the A scale of a noise meter (dB (A)).
###Why high emissions and high noise level for luxury cars? I can’t quite imagine a sports car with a V12 engine and maximum speed of 350kph having an emissions/ noise level bypass. Fortunately not everyone can afford one. Good news to our Earth!
##Upper 70s (dB (A)) are annoyingly loud to some people. So next I compare the Average of the all the Noise made by these engines to the threshold 70s (dB (A)). ##8. Go to Analytics and click Reference Line, choose Line Only. Click on Value and choose create parameter. Created a parameter called “Annoyingly Loud”, and click OK. And then go to Analytics and click Average Line. ##Clearly the Average noise made by all these years from 2000 to 2013 have surpassed the standards of human comfort.